export const isNumber = (str: string) => /^\d+(\.\d{1,2})?$/.test(str) // 正整数
export const isNumber2 = (str: string) => /^\d+$/.test(str) //  纯数字
export const isChinese = (str: string) => /^[\u0391-\uFFE5]+$/.test(str)
export const isEmail = (str: string) => /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(str) //  邮件
export const specialCharacter = (str: string) => /[\\:*<>"|?/^+&]/.test(str) // 过滤特殊字符
export const numberAndLetter = (str: string) => /^[A-Za-z0-9_]+$/.test(str) // 数字和字母
export const isLetter = (str: string) => /^[A-Za-z]+$/.test(str) // 字母
export const urlValidate = (str: string) => /(https?|ftp|file):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/.test(str) // url
export const ipValidate = (str: string) => /((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)/.test(str) // ip
